﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IceDog.DNL.CSharp.DesignPattern.FrontControllerPattern.SchoolManage
{
    /// <summary>
    /// 调度器（Dispatcher） - 前端控制器可能使用一个调度器对象来调度请求到相应的具体处理程序。
    /// </summary>
    public class Dispatcher
    {
        private StudentView studentView;
        private HomeView homeView;

        public Dispatcher()
        {
            studentView = new StudentView();
            homeView = new HomeView();
        }

        public void Dispatch(RequestType requestType)
        {
            switch (requestType)
            {
                case RequestType.Home:
                    homeView.Show();
                    break;
                case RequestType.Student:
                    studentView.Show();
                    break;
                default:
                    break;
            }
        }
    }
}
